<template>
  <div>
    <h2>home页</h2>
    <button @click="addNum">+</button>
    {{ $store.state.count }}
    <br>
    {{ $store.getters.doubleCount }}
    <hr>
    <ul>
      <li v-for="cate in $store.state.cates" :key="cate.id">
        <h5>{{cate.name}}</h5>
        <img :src="cate.icon" width="50" alt="">
      </li>
    </ul>

  </div>
</template>

<script>
export default {
  name: 'HomePage',
  data () {
    return {
      msg: '你好世界'
    }
  },
  methods: {
    addNum () {
      this.$store.commit('ADD_COUNT', 5)
    }
  },
  created () {
    this.$store.dispatch('FETCH_CATES', {
      page: 1,
      pageSize: 10
    })
  },
  mounted () {
    console.log(this.$store);
  }
}
</script>

<style lang="scss" scoped>

</style>
